package org.example.aaaatest.a1;

import com.amap.car.order.i18n.util.TimeZoneUtil;

import javax.xml.crypto.Data;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Date;
import java.util.TimeZone;

/**
 * @description:
 * @author: wangbaogui
 * @create: 2025/4/9 22:04
 **/
public class aa1 {
    public static void main(String[] args) {

        TimeZone timeZone = TimeZoneUtil.getAdminTimeZone( 35.713246,139.762315);
        ZoneId zoneId = timeZone.toZoneId();
        System.out.println("zoneId = " + zoneId);

        long millis1 = 1744092126189L;
        Date date1 = new Date(millis1);
        BigDecimal currentMoneyValue = new BigDecimal(1.3333);
if(        currentMoneyValue.compareTo(BigDecimal.ZERO) != 0

){
    System.out.println("currentMoneyValue = " + currentMoneyValue);
}
        // 四舍五入保留两位小数
        BigDecimal roundedValue = currentMoneyValue.setScale(2, RoundingMode.HALF_UP);

        // 乘以100
        BigDecimal multipliedValue = roundedValue.multiply(new BigDecimal("100"));

        // 转换为 Integer 类型
        int integerValue = multipliedValue.intValue();

        System.out.println("原始值: " + currentMoneyValue);
        System.out.println("四舍五入后的值: " + roundedValue);
        System.out.println("乘以100后的值: " + multipliedValue);
        System.out.println("转换为 Integer 类型的值: " + integerValue);

        ArrayList<String> strings = new ArrayList<>();
        if(strings==null ||strings.size()==0){
            System.out.println("strings = " + strings);
        }


        //   extracted(zoneId,date1);
    }

    private static Date extracted(ZoneId zoneId ,Date date) {
        // 第二个时区的 ZoneId
        ZoneId eastEightZoneId = ZoneId.of("Asia/Shanghai");
        /*
        *
        * */

        Instant now = Instant.now();
        ZoneOffset offset1 = zoneId.getRules().getOffset(now);
        ZoneOffset offset2 = eastEightZoneId.getRules().getOffset(now);

        long diffMillis = (offset1.getTotalSeconds() - offset2.getTotalSeconds()) * 1000L;
        System.out.println("相差毫秒数：" + diffMillis);

        long timeInMillis = date.getTime();

        /*

         */
        // 加上毫秒数
        timeInMillis += diffMillis;

        // 设置新的时间
        date.setTime(timeInMillis);

        System.out.println("date = " + date);
        return date;
    }

}
